package com.wyzz.hr.bo.impl;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.commons.beanutils.PropertyUtils;
import org.hibernate.FetchMode;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.wyzz.hr.base.Status;
import com.wyzz.hr.bo.IIFindTip;
import com.wyzz.hr.dao.IIFindTipDao;
import com.wyzz.hr.pojo.Empaddconf;
import com.wyzz.hr.pojo.Employee;
import com.wyzz.hr.pojo.Leavebalance;
import com.wyzz.hr.pojo.Leaverequest;
import com.wyzz.hr.pojo.Overtimerequest;
import com.wyzz.hr.pojo.Recruitplan;
import com.wyzz.hr.pojo.Tremployeeplan;
import com.wyzz.hr.pojo.Userinfo;
import com.wyzz.hr.util.DateUtil;

public class FindTipImpl implements IIFindTip {

	public FindTipImpl() {
		format = new SimpleDateFormat("yyyy-MM-dd");
		currentYear = DateUtil.getYear(new Date());
	}

	public ArrayList getTip401() {
		ArrayList tipArrayList = new ArrayList();
		StringBuffer balanceS = new StringBuffer();
		StringBuffer clanderS = new StringBuffer();
		Date yearStartDate = DateUtil.getYearFirstDay(currentYear);
		Date yearEndDate = DateUtil.getYearEndDay(currentYear);
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Leavecalendar.class);
		detachedCriteria.add(Restrictions.and(Restrictions.ge("lcDate",
				yearStartDate), Restrictions.le("lcDate", yearEndDate)));
		if (findTipDao.findRowCountByCriteria(detachedCriteria) == 0) {
			clanderS.append(getJSString("../examin/leavecalendarManage.action",
					"\u8BBE\u7F6E"));
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u672C\u5E74\u5EA6\u516C\u5171\u5047\u65E5\u672A\u4F5C\u8C03\u6574\uFF0C\u8BF7\u4E88\u4EE5")
							.append(clanderS).append("\u3002<br>").toString());
		}
		DetachedCriteria detachedCriteria2 = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Leavebalance.class);
		List balance = findTipDao.findByCriteria(detachedCriteria2);
		detachedCriteria.add(Restrictions.eq("lbYear", Integer
				.toString(currentYear)));
		DetachedCriteria detachedCriteria3 = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Employee.class);
		detachedCriteria3.add(Restrictions.eq("empStatus", Integer.valueOf(1)));
		List empList = findTipDao.findByCriteria(detachedCriteria3);
		int listSize = empList.size();
		int balanceCount = 0;
		boolean flag = false;
		int balanceSize = balance.size();
		for (int i = 0; i < listSize; i++) {
			flag = false;
			Employee emp = (Employee) empList.get(i);
			int j = 0;
			do {
				if (j >= balanceSize)
					break;
				if (emp.getId().equals(
						((Leavebalance) balance.get(j)).getLbEmpNo().getId()
								.toString())) {
					flag = true;
					break;
				}
				j++;
			} while (true);
			if (!flag)
				balanceCount++;
		}

		if (balanceCount > 0) {
			balanceS
					.append(getJSString(
							"../examin/leavebalanceManage.action?tab=1",
							"\u8BBE\u7F6E"));
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u6709\u5458\u5DE5\u672A\u8BBE\u7F6E\u672C\u5E74\u5EA6\u5E74\u5047\u989D\u5EA6\uFF0C\u8BF7\u4E88\u4EE5")
							.append(balanceS).append("\u3002<br>").toString());
		}
		tipArrayList.addAll(getTip4012());
		return tipArrayList;
	}

	public ArrayList getTip4012() {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria dc = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Leaverequest.class);
		dc.add(Restrictions.in(Leaverequest.PROP_LR_STATUS, Status.IN_PROCESS));
		dc.add(Restrictions.isNull(Leaverequest.PROP_LR_NEXT_APPROVER));
		int number = findTipDao.findRowCountByCriteria(dc);
		if (number != 0) {
			String tempS = getJSString("../examin/hrExaminSearch.action?tab=1",
					"\u5907\u6848");
			tipArrayList.add((new StringBuilder()).append("\u6709").append(
					number).append(
					"\u4E2A\u8BF7\u5047\u7533\u8BF7\u7B49\u5F85HR").append(
					tempS).append("\u3002<br>").toString());
		}
		DetachedCriteria dc2 = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Overtimerequest.class);
		dc2.add(Restrictions.in(Overtimerequest.PROP_OR_STATUS,
				Status.IN_PROCESS));
		dc2.add(Restrictions.isNull(Overtimerequest.PROP_OR_NEXT_APPROVER));
		int number2 = findTipDao.findRowCountByCriteria(dc2);
		if (number2 != 0) {
			String tempS = getJSString("../examin/hrExaminSearch.action?tab=2",
					"\u5907\u6848");
			tipArrayList.add((new StringBuilder()).append("\u6709").append(
					number2).append(
					"\u4E2A\u52A0\u73ED\u7533\u8BF7\u7B49\u5F85HR").append(
					tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip4112(String posNo) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Leaverequest.class);
		detachedCriteria.add(Restrictions.eq(
				Leaverequest.PROP_LR_NEXT_APPROVER, posNo));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString(
					"../examin/deptExaminSearch.action?tab=1", "\u6279\u51C6");
			tipArrayList.add((new StringBuilder()).append("\u6709").append(
					number).append(
					"\u4E2A\u8BF7\u5047\u7533\u8BF7\u7B49\u5F85\u60A8\u7684")
					.append(tempS).append("\u3002<br>").toString());
		}
		DetachedCriteria detachedCriteria2 = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Overtimerequest.class);
		detachedCriteria2.add(Restrictions.eq(
				Overtimerequest.PROP_OR_NEXT_APPROVER, posNo));
		int number2 = findTipDao.findRowCountByCriteria(detachedCriteria2);
		if (number2 != 0) {
			String tempS = getJSString(
					"../examin/deptExaminSearch.action?tab=2", "\u6279\u51C6");
			tipArrayList.add((new StringBuilder()).append("\u6709").append(
					number2).append(
					"\u4E2A\u52A0\u73ED\u7533\u8BF7\u7B49\u5F85\u60A8\u7684")
					.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip411(String id) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Leaverequest.class);
		detachedCriteria.add(Restrictions.eq("lrStatus", Integer.valueOf(21)));
		detachedCriteria.add(Restrictions.eq("lrEmpNo.id", id));
		Date date = getLastLoginTime(id);
		if (date != null)
			detachedCriteria.add(Restrictions.gt(
					Leaverequest.PROP_LR_LAST_CHANGE_TIME, date));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String temp = getJSString("../examin/myExamins.action?tab=1",
					"\u67E5\u770B");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u60A8\u6709\u8BF7\u5047\u7533\u8BF7\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u6CE8\u610F")
							.append(temp).append("\u3002<br>").toString());
		}
		DetachedCriteria detachedCriteria2 = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Overtimerequest.class);
		detachedCriteria2.add(Restrictions.eq("orStatus", Integer.valueOf(21)));
		detachedCriteria2.add(Restrictions.eq("orEmpNo.id", id));
		date = getLastLoginTime(id);
		if (date != null)
			detachedCriteria.add(Restrictions.gt(
					Overtimerequest.PROP_OR_LAST_CHANGE_TIME, date));
		int number2 = findTipDao.findRowCountByCriteria(detachedCriteria2);
		if (number2 != 0) {
			String temp = getJSString("../examin/myExamins.action?tab=2",
					"\u67E5\u770B");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u60A8\u6709\u52A0\u73ED\u7533\u8BF7\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u6CE8\u610F")
							.append(temp).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip301() {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Trtype.class);
		int trtypeList = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (trtypeList == 0) {
			String list = getJSString("../training/trBasicConfig.action",
					"\u8BBE\u7F6E");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u7CFB\u7EDF\u4E2D\u5C1A\u672A\u8BBE\u7F6E\u57F9\u8BAD\u79CD\u7C7B\uFF0C\u8BF7\u4E88\u4EE5")
							.append(list).append("\u3002<br>").toString());
		}
		detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Tremployeeplan.class);
		detachedCriteria.add(Restrictions.in(Tremployeeplan.PROP_TRP_STATUS,
				Status.IN_PROCESS));
		detachedCriteria.add(Restrictions
				.isNull(Tremployeeplan.PROP_TRP_NEXT_APPROVER));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString("../training/trepHrApprove.action",
					"\u5907\u6848");
			tipArrayList
					.add((new StringBuilder())
							.append("\u6709")
							.append(number)
							.append(
									"\u4E2A\u90E8\u95E8\u5DF2\u5BA1\u7684\u5458\u5DE5\u57F9\u8BAD\u8BA1\u5212\u7B49\u5F85HR")
							.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip3112(String posNo) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Tremployeeplan.class);
		detachedCriteria.add(Restrictions.eq(
				Tremployeeplan.PROP_TRP_NEXT_APPROVER, posNo));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString("../training/trepDeptApprove.action",
					"\u5BA1\u6279");
			tipArrayList
					.add((new StringBuilder())
							.append("\u6709")
							.append(number)
							.append(
									"\u4E2A\u5DF2\u63D0\u4EA4\u7684\u5458\u5DE5\u57F9\u8BAD\u8BA1\u5212\u7B49\u5F85\u60A8\u7684")
							.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip311(String id) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Tremployeeplan.class);
		detachedCriteria.add(Restrictions.eq("trpTraineeNo.id", id));
		detachedCriteria.add(Restrictions.eq("trpStatus", Integer.valueOf(21)));
		Date date = getLastLoginTime(id);
		if (date != null)
			detachedCriteria.add(Restrictions.gt("trpLastChangeTime", date));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String temp = getJSString("../training/myTrainingList.action",
					"\u67E5\u770B");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u60A8\u6709\u57F9\u8BAD\u8BA1\u5212\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u6CE8\u610F")
							.append(temp).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip601() {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Recruitchannel.class);
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number == 0) {
			String list = getJSString(
					"../recruitment/recruitchannellist.action", "\u8BBE\u7F6E");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u7CFB\u7EDF\u4E2D\u5C1A\u65E0\u62DB\u8058\u6E20\u9053\uFF0C\u8BF7\u4E88\u4EE5")
							.append(list).append("\u3002<br>").toString());
		}
		detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Recruitplan.class);
		detachedCriteria.add(Restrictions.in(Recruitplan.PROP_RECP_STATUS,
				Status.IN_PROCESS));
		detachedCriteria.add(Restrictions
				.isNull(Recruitplan.PROP_RECP_NEXT_APPROVER));
		number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString(
					"../recruitment/ApproverRecruitplanHR.action",
					"\u5907\u6848");
			tipArrayList
					.add((new StringBuilder())
							.append("\u6709")
							.append(number)
							.append(
									"\u4E2A\u90E8\u95E8\u5DF2\u5BA1\u7684\u5458\u5DE5\u62DB\u8058\u8BA1\u5212\u7B49\u5F85HR")
							.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip6112(String posNo) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Recruitplan.class);
		detachedCriteria.add(Restrictions.eq(
				Recruitplan.PROP_RECP_NEXT_APPROVER, posNo));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString(
					"../recruitment/ApproverRecruitplanDept.action",
					"\u5BA1\u6279");
			tipArrayList
					.add((new StringBuilder())
							.append("\u6709")
							.append(number)
							.append(
									"\u4E2A\u5DF2\u63D0\u4EA4\u7684\u5458\u5DE5\u62DB\u8058\u8BA1\u5212\u7B49\u5F85\u60A8\u7684")
							.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip611(String id) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Recruitplan.class);
		detachedCriteria.add(Restrictions.eq("recpCreateBy.id", id));
		detachedCriteria
				.add(Restrictions.eq("recpStatus", Integer.valueOf(21)));
		Date date = getLastLoginTime(id);
		if (date != null)
			detachedCriteria.add(Restrictions.gt("recpLastChangeTime", date));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String temp = getJSString(
					"../recruitment/SearchRecruitplan.action", "\u67E5\u770B");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u60A8\u6709\u62DB\u8058\u8BA1\u5212\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u6CE8\u610F")
							.append(temp).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip2012() {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Empsalaryadj.class);
		detachedCriteria.add(Restrictions.eq("esaStatus", Integer.valueOf(21)));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString(
					"../compensation/searchApproveCompaplan.action?month=all",
					"\u5BA1\u6279");
			tipArrayList
					.add((new StringBuilder())
							.append("\u6709")
							.append(number)
							.append(
									"\u4E2A\u90E8\u95E8\u5DF2\u5BA1\u7684\u8C03\u85AA\u8BA1\u5212\u7B49\u5F85\u60A8\u7684")
							.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip2112(String id) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Empsalaryadj.class);
		detachedCriteria.add(Restrictions.eq("esaStatus", Integer.valueOf(11)));
		detachedCriteria.add(Restrictions.eq("esaNextApprover.id", id));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String tempS = getJSString(
					"../compensation/searchBatchCompaplan.action",
					"\u5BA1\u6279");
			tipArrayList
					.add((new StringBuilder())
							.append(
									"\u6709\u5DF2\u63D0\u4EA4\u7684\u8C03\u85AA\u8BA1\u5212\u7B49\u5F85\u60A8\u7684")
							.append(tempS).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public ArrayList getTip211(String id) {
		ArrayList tipArrayList = new ArrayList();
		DetachedCriteria detachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Empsalaryadj.class);
		detachedCriteria.add(Restrictions.eq("esaStatus", Integer.valueOf(2)));
		detachedCriteria.setFetchMode("esaCreateBy", FetchMode.JOIN);
		detachedCriteria.add(Restrictions.eq("esaCreateBy.id", id));
		Date date = getLastLoginTime(id);
		if (date != null)
			detachedCriteria.add(Restrictions.gt("esaLastChangeTime", date));
		int number = findTipDao.findRowCountByCriteria(detachedCriteria);
		if (number != 0) {
			String temp = getJSString(
					"../compensation/searchBatchCompaplan.action",
					"\u67E5\u770B");
			tipArrayList
					.add((new StringBuilder())
							.append("\u60A8\u6709")
							.append(number)
							.append(
									"\u8C03\u85AA\u8BA1\u5212\u88AB\u62D2\u7EDD\uFF0C\u8BF7\u6CE8\u610F")
							.append(temp).append("\u3002<br>").toString());
		}
		return tipArrayList;
	}

	public List getObjectList(DetachedCriteria detachedCriteria) {
		if (detachedCriteria == null)
			return null;
		else
			return findTipDao.findByCriteria(detachedCriteria);
	}

	public IIFindTipDao getFindTipDao() {
		return findTipDao;
	}

	public void setFindTipDao(IIFindTipDao findTipDao) {
		this.findTipDao = findTipDao;
	}

	public Date getLastLoginTime(String userId) {
		DetachedCriteria userinfoDeta = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Userinfo.class);
		userinfoDeta.add(Restrictions.eq(Userinfo.PROP_ID, userId));
		List userList = findTipDao.findByCriteria(userinfoDeta);
		Userinfo userInfo = null;
		if (userList != null && userList.size() == 1)
			userInfo = (Userinfo) userList.get(0);
		if (userInfo == null)
			return null;
		else
			return userInfo.getUiLastLoginTime();
	}

	public boolean checkDateInMonth(Date date) {
		if (date == null) {
			return false;
		} else {
			Calendar cal = Calendar.getInstance();
			cal.add(2, 0);
			int month = cal.get(2) + 1;
			SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
			String mydate = sp.format(date);
			int monthInt = Integer.parseInt(mydate.substring(mydate
					.indexOf('-') + 1, mydate.lastIndexOf('-')));
			return month == monthInt;
		}
	}

	public boolean checkDateInYearAndMonth(Date date) {
		if (date == null) {
			return false;
		} else {
			Calendar cal = Calendar.getInstance();
			cal.add(2, 0);
			int month = cal.get(2) + 1;
			int year = cal.get(1);
			SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
			String mydate = sp.format(date);
			int monthInt = Integer.parseInt(mydate.substring(mydate
					.indexOf('-') + 1, mydate.lastIndexOf('-')));
			int yearInt = Integer.parseInt(mydate.substring(0, mydate
					.indexOf('-')));
			return month == monthInt && year == yearInt;
		}
	}

	public boolean checkDateInDay(Date date) {
		if (date == null) {
			return false;
		} else {
			Calendar cal = Calendar.getInstance();
			cal.add(2, 0);
			int month = cal.get(2) + 1;
			int day = cal.get(5);
			SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
			String mydate = sp.format(date);
			int monthInt = Integer.parseInt(mydate.substring(mydate
					.indexOf('-') + 1, mydate.lastIndexOf('-')));
			int dayInt = Integer.parseInt(mydate.substring(
					mydate.lastIndexOf('-') + 1).trim());
			return month == monthInt && day <= dayInt;
		}
	}

	public Date getLastMonthDate() {
		Calendar cal = Calendar.getInstance();
		cal.add(2, 0);
		cal.set(5, 0);
		return cal.getTime();
	}

	public Date getNextMonthDate() {
		Calendar cal = Calendar.getInstance();
		cal.add(2, 1);
		cal.set(5, 1);
		return cal.getTime();
	}

	public Date getNextYearDate() {
		Calendar cal = Calendar.getInstance();
		cal.add(1, 1);
		cal.set(5, 1);
		return cal.getTime();
	}

	public String getThisYear() {
		Calendar cal = Calendar.getInstance();
		cal.add(1, 0);
		int year = cal.get(1);
		return Integer.toString(year);
	}

	public String getJSString(String action, String tip) {
		return (new StringBuilder())
				.append("<span onclick =\"toAction('")
				.append(action)
				.append(
						"');\" style =\"cursor:pointer\"><font color =\"blue\">")
				.append(tip).append("</font></span>").toString();
	}

	public List getEmployeeAdditionalTip() {
		DetachedCriteria additionalDateTip = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Empaddconf.class);
		additionalDateTip.add(Restrictions.eq("eadcFieldType", "date"));
		additionalDateTip
				.add(Restrictions.eq("eadcTableName", "empadditional"));
		additionalDateTip.add(Restrictions.not(Restrictions
				.isNull("eadcFieldValue")));
		additionalDateTip.add(Restrictions.ne("eadcFieldValue", ""));
		List additionalDateTipList = findTipDao
				.findByCriteria(additionalDateTip);
		DetachedCriteria additionalDetachedCriteria = DetachedCriteria
				.forClass(com.wyzz.hr.pojo.Employee.class);
		additionalDetachedCriteria.add(Restrictions.eq("empStatus",
				new Integer(1)));
		List additionalList = findTipDao
				.findByCriteria(additionalDetachedCriteria);
		StringBuffer additionalTip = new StringBuffer();
		int additionalTipSize = 0;
		Map tipMap = new HashMap();
		for (Iterator i$ = additionalDateTipList.iterator(); i$.hasNext();) {
			Empaddconf conf = (Empaddconf) i$.next();
			Integer tipDays = getIntegerValue(conf.getEadcFieldValue());
			if (tipDays != null) {
				Iterator i = additionalList.iterator();
				while (i.hasNext()) {
					Employee add = (Employee) i.next();
					if (additionalTipSize > 0 && additionalTipSize % 4 == 0) {
						additionalTipSize++;
						additionalTip.append("<br>");
					}
					Date date;
					try {
						date = getDateValue(add, conf.getEadcSeq().intValue());
						if (isTipDate(date, tipDays.intValue())) {
							String tip = (String) tipMap.get(conf
									.getEadcFieldName());
							String tmp = (new StringBuilder()).append(
									getJSString((new StringBuilder()).append(
											"../profile/myInfo.action?empNo=")
											.append(add.getId()).append(
													"&empName=").append(
													add.getEmpName()).append(
													"&tab=2").toString(), add
											.getEmpName())).append("\u3001")
									.toString();
							if (tip == null)
								tipMap
										.put(
												conf.getEadcFieldName(),
												(new StringBuilder())
														.append(tipDays)
														.append("\u5929\u5185")
														.append(
																conf
																		.getEadcFieldName())
														.append(
																"\u5230\u671F\u7684\u5458\u5DE5\uFF1A<br/>")
														.append(tmp).toString());
							else
								tipMap.put(conf.getEadcFieldName(),
										(new StringBuilder()).append(
												(String) tipMap.get(conf
														.getEadcFieldName()))
												.append(tmp).toString());
						}
					} catch (ParseException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
		}

		List resultSet = new ArrayList();
		String tmpValue;
		for (Iterator i$ = tipMap.keySet().iterator(); i$.hasNext(); resultSet
				.add(tmpValue)) {
			String key = (String) i$.next();
			tmpValue = ((String) tipMap.get(key)).substring(0, ((String) tipMap
					.get(key)).length() - 1);
		}

		return resultSet;
	}

	private boolean isTipDate(Date date, int days) {
		if (date == null)
			return false;
		boolean rs = false;
		Calendar now = Calendar.getInstance();
		Calendar cloneNow = (Calendar) now.clone();
		Calendar db = Calendar.getInstance();
		db.setTime(date);
		int dbday = db.get(6);
		int nowDay = now.get(6);
		int tmp = dbday - nowDay;
		rs = 0 <= tmp && tmp <= days;
		if (rs)
			return true;
		int oldyear = now.get(1);
		now.add(5, days);
		int nowYear = now.get(1);
		if (nowYear != oldyear) {
			int t = days - (365 - cloneNow.get(6));
			int tmp2 = now.get(6) - dbday;
			rs = 0 <= tmp2 && tmp2 <= t;
		}
		return rs;
	}

	private Date getDateValue(Employee additional, int index)
			throws ParseException {
		String method = (new StringBuilder()).append("empAdditional").append(
				index).toString();
		Object rs;
		String result;
		try {
			rs = PropertyUtils.getProperty(additional, method);
			if (rs == null)
				return null;
		} catch (Exception e) {
			return null;
		}
		result = (String) rs;
		return format.parse(result);
	}

	private Integer getIntegerValue(String str) {
		try {
			return Integer.valueOf(str);
		} catch (NumberFormatException e) {
			return null;
		}
	}

	private IIFindTipDao findTipDao;
	private DateFormat format;
	private int currentYear;
}
